//
//  DesignerListViewController.m
//  BigJoy
//
//  Created by Rowling on 2017/6/15.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "DesignerListViewController.h"
#import "DesignerCell.h"

@interface DesignerListViewController ()
@property (nonatomic,strong)NSString * titleStr;
@property (nonatomic,strong)NSString *EnStr;
@end

@implementation DesignerListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUI];
}

-(void)setUI {
    if (self.jumpType == MYFANS) {
          self.titleStr = @"我的粉丝";
          self.EnStr = @"FANS";
    }
    if (self.jumpType == MYSTAR) {
          self.titleStr = @"我的关注";
          self.EnStr = @"FOLLOW";

    }
    if (self.jumpType == DESIGNERMORE) {
          self.titleStr = @"认证设计师";
          self.EnStr = @"";

    }
    [self.view addSubview: self.XMTableview];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    DesignerCell * cell = [DesignerCell cellWithTableview:tableView];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 90;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView * headView = [[UIView alloc]init];
    headView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:headView];
    [headView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
        make.height.equalTo(@32);
    }];
    UILabel * titleLabel = [XMSuperHelper XMLableWithColor:[UIColor blackColor] Title:self.EnStr FontSize:13];
    UILabel * subTitlabel = [XMSuperHelper XMLableWithColor:[UIColor colorForHex:@"333333"] Title:self.titleStr FontSize:11];
    subTitlabel.font = [UIFont fontWithName:@"PingFang-SC-Light" size:11];
    [subTitlabel sizeToFit];
    [headView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headView).offset(10);
        make.centerY.equalTo(headView);
    }];
    [headView addSubview: subTitlabel];
    [subTitlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel.mas_right).offset(10);
        make.centerY.equalTo(headView);
    }];
    UIView * lineView = [UIView new];
    [headView addSubview:lineView];
    lineView.backgroundColor = XMColor(220, 220, 220);
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.equalTo(headView);
        make.height.equalTo(@1);
    }];
    return headView;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 32;
}

@end
